﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/User/ViewMasterPage.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <title>数据历史</title>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="LeftMenuContent" runat="server">
    <li><a href="/User/Index"><span class="glyphicon glyphicon-dashboard"></span>首页</a></li>
    <li><a href="/User/Widgets"><span class="glyphicon glyphicon-th"></span>医生</a></li>
    <li><a href="/User/Charts"><span class="glyphicon glyphicon-stats"></span>实时数据</a></li>
    <li class="active"><a href="/User/Tables"><span class="glyphicon glyphicon-list-alt"></span>数据历史</a></li>
    <li><a href="/User/Forms"><span class="glyphicon glyphicon-pencil"></span>病历</a></li>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">
        <div class="row">
            <ol class="breadcrumb">
                <li><a href="#"><span class="glyphicon glyphicon-home"></span></a></li>
                <li class="active">数据历史</li>
            </ol>
        </div>
        <!--/.row-->

        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">数据历史</h1>
            </div>
        </div>
        <!--/.row-->
        <script>
            function submit(data) {
                $.ajax(
                  {
                      url: "/Admin/Del",
                      dataType: "Text",
                      type: "POST",
                      data: { "id": data },
                      success: function () {
                          window.location.reload();
                      }
                  });
            }
        </script>

        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <table id="table" data-toggle="table" data-url="/User/Json" data-show-refresh="true" data-show-toggle="true" data-show-columns="true" data-search="true"
                            data-pagination="true" data-sort-name="name" data-sort-order="desc">
                            <thead>
                                <tr>
                                    <th data-field="Id" data-with="0" data-visible="false" data-align="center">ID</th>
                                    <th data-field="Time_Str" data-sortable="true" data-align="center">时间</th>
                                    <th data-field="Heart" data-sortable="true" data-align="center">心率</th>
                                    <th data-field="Blood" data-sortable="true" data-align="center">血压</th>
                                    <th data-field="Temp" data-sortable="true" data-align="center">体温</th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <!--/.row-->
    </div>
    <!--/.main-->
    <div class="modal fade" id="myModal_Add" tabindex="-1" role="dialog"
        aria-labelledby="myModalLabel" aria-hidden="true">
        <%--<div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close"
                        data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h2 class="modal-title" id="myModalLabel_Add">修改
                    </h2>
                    <form role="form">         
                      <div class="form-group">
                            <label>姓名：</label>
                            <input class="form-control" id="Placeholder_Add">
                       </div>  
                        <div class="row">
                            <div class="col-xs-4">
                                <div class="form-group">
                                    <label>科室：</label>
                                    <div class="form-group">
                                        <select class="selectpicker form-control" id="office_Select_Add">
                                            <option>内科</option>
                                            <option>外科</option>
                                            <option>妇产科</option>
                                            <option>儿科</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xs-4">
                                <label>年龄：</label>
                                <input class="form-control" id="old_TxtBox_Add">
                            </div>
                            <div class="col-xs-4">
                                <label>性别：</label>
                                <div class="form-group">
                                    <select class="selectpicker form-control" id="sex_Select_Add">
                                        <option>男</option>
                                        <option>女</option>

                                    </select>
                                </div>
                            </div>

                        </div>
                        <div class="form-group">
                            <label>联系电话：</label>
                            <input class="form-control" id="tel_TxtBox_Add">
                        </div>

                        <div class="form-group">
                            <label> 邮箱：</label>
                            <input class="form-control" id="email_TxtBox_Add">
                        </div>

                        <div class="form-group">
                            <label>上传照片</label>
                            <input type="file" style="border:1px dotted #ccc">
                            <p class="help-block">上传小于1M一寸免冠照片（*.jpg  *.png）</p>
                        </div>

                         <label>被监护者</label>
                        <div class="form-group has-success">
                            <input class="form-control" placeholder="Success">
                        </div>
                        <div class="form-group has-success">
                            <input class="form-control" placeholder="Warning">
                        </div>
                        <div class="form-group has-success">
                            <input class="form-control" placeholder="Error">
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default"
                        data-dismiss="modal">
                        关闭
                    </button>
                    <button type="button" class="btn btn-primary" id="dialog_btn_add">
                        提交更改
                    </button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>--%>

        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close"
                        data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h2 class="modal-title" id="myModalLabel_Add">修改
                    </h2>
                    <form role="form">
                        <div class="form-group">
                            <label>姓名：</label>
                            <input class="form-control" id="Placeholder_Add">
                        </div>
                        <div class="row">
                            <div class="col-xs-4">
                                <div class="form-group">
                                    <label>科室：</label>
                                    <div class="form-group">
                                        <select class="selectpicker form-control" id="office_Select_Add">
                                            <option>内科</option>
                                            <option>外科</option>
                                            <option>妇产科</option>
                                            <option>儿科</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xs-4">
                                <label>年龄：</label>
                                <input class="form-control" id="old_TxtBox_Add">
                            </div>
                            <div class="col-xs-4">
                                <label>性别：</label>
                                <div class="form-group">
                                    <select class="selectpicker form-control" id="sex_Select_Add">
                                        <option>男       </option>
                                        <option>女       </option>

                                    </select>
                                </div>
                            </div>

                        </div>
                        <div class="form-group">
                            <label>联系电话：</label>
                            <input class="form-control" id="tel_TxtBox_Add">
                        </div>

                        <div class="form-group">
                            <label>邮箱：</label>
                            <input class="form-control" id="email_TxtBox_Add">
                        </div>

                        <div class="form-group">
                            <label>上传照片</label>
                            <input type="file" style="border: 1px dotted #ccc">
                            <p class="help-block">上传小于1M一寸免冠照片（*.jpg  *.png）</p>
                        </div>

                        <div class="row">
                            <div class="col-xs-4">
                                <label>身高：</label>
                                <input class="form-control" id="height_TxtBox_Add" readonly>
                            </div>
                            <div class="col-xs-4">
                                <label>体重：</label>
                                <input class="form-control" id="wigh_TxtBox_Add" readonly>
                            </div>
                            <div class="col-xs-4">
                                <div class="input-append date form_datetime">
                                    <label>入院时间</label>
                                    <input size="16" type="text" value="2012-06-15 14:45" readonly class="form_datetime">
                                </div>
                            </div>
                        </div>

<%--                        <div class="row">
                            <div class="col-xs-4">
                                <label>血压：</label>
                                <input class="form-control" id="blood_TxtBox_Add" readonly>
                            </div>
                            <div class="col-xs-4">
                                <label>心率：</label>
                                <input class="form-control" id="heart_TxtBox_Add" readonly>
                            </div>
                            <div class="col-xs-4">
                                <label>体温：</label>
                                <input class="form-control" id="temp_TxtBox_Add" readonly>
                            </div>
                        </div>--%>


                        <div class="form-group">
                            <label>病情</label>
                            <textarea class="form-control" rows="3"></textarea>
                        </div>

                        <div class="form-group">
                            <label>床位：</label>
                            <input class="form-control" id="bleed_Add">
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default"
                        data-dismiss="modal">
                        关闭
                    </button>
                    <button type="button" class="btn btn-primary" id="dialog_btn_add">
                        提交更改
                    </button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
    </div>
    <div class="modal fade" id="myModal_Update">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close"
                        data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h2 class="modal-title" id="myModalLabel_Update">修改
                    </h2>
                    <form role="form">
                        <div class="form-group">
                            <label>姓名：</label>
                            <input class="form-control" id="Placeholder_Update">
                        </div>
                        <div class="row">
                            <div class="col-xs-4">
                                <div class="form-group">
                                    <label>科室：</label>
                                    <div class="form-group">
                                        <select class="selectpicker form-control" id="office_Select_Update">
                                            <option>内科</option>
                                            <option>外科</option>
                                            <option>妇产科</option>
                                            <option>儿科</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xs-4">
                                <label>年龄：</label>
                                <input class="form-control" id="old_TxtBox_Update">
                            </div>
                            <div class="col-xs-4">
                                <label>性别：</label>
                                <div class="form-group">
                                    <select class="selectpicker form-control" id="sex_Select_Update">
                                        <option>男</option>
                                        <option>女</option>

                                    </select>
                                </div>
                            </div>

                        </div>
                        <div class="form-group">
                            <label>联系电话：</label>
                            <input class="form-control" id="tel_TxtBox_Update">
                        </div>

                        <div class="form-group">
                            <label>邮箱：</label>
                            <input class="form-control" id="email_TxtBox_Update">
                        </div>

                        <div class="form-group">
                            <label>上传照片</label>
                            <input type="file" style="border: 1px dotted #ccc">
                            <p class="help-block">上传小于1M一寸免冠照片（*.jpg  *.png）</p>
                        </div>

                        <label>被监护者</label>
                        <div class="form-group has-success">
                            <input class="form-control" placeholder="Success">
                        </div>
                        <div class="form-group has-success">
                            <input class="form-control" placeholder="Warning">
                        </div>
                        <div class="form-group has-success">
                            <input class="form-control" placeholder="Error">
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default"
                        data-dismiss="modal">
                        关闭
                    </button>
                    <button type="button" class="btn btn-primary" id="dialog_btn_update">
                        提交更改
                    </button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal -->
    </div>
    <div class="modal fade" id="myModal_Del">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close"
                        data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h2 class="modal-title" id="myModalLabel_Del">删除
                    </h2>
                </div>
                <div class="modal-body">
                    是否要删除此条数据
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default"
                        data-dismiss="modal">
                        关闭
                    </button>
                    <button type="button" class="btn btn-primary" id="dialog_btn_del">
                        提交更改
                    </button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal -->
    </div>
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="JsContent" runat="server">
    <script src="../../Content/User/js/bootstrap-datetimepicker.js"></script>
    <script src="../../Content/User/js/bootstrap-datetimepicker.zh-CN.js"></script>
    <script>
        var $table = $('#table');
        var $button_Update = $('#btnUpdate');
        var $button_Del = $('#btnDel');
        var $button_Add = $('#btnAdd');
        var $tab_Json;
        $(function () {
            $button_Update.click(function () {
                $tab_Json = eval(JSON.stringify($table.bootstrapTable('getSelections')));
                if ($tab_Json[0]) {
                    $('#myModal_Update').modal('show');
                    $('#Placeholder_Update').val($tab_Json[0].name);
                }
                else {
                    alert("请选择修改项!");
                }
            });
            $('#dialog_btn_update').click(function () {
                $tab_Json = eval(JSON.stringify($table.bootstrapTable('getSelections')));
                $("#myModal_Update").modal('hide');
                $.post("/User/SetJson", {
                    "name": $('#Placeholder_Update').val(), "id": $tab_Json[0].id
                }, function (data) {
                    if (data) {
                        $table.bootstrapTable('load', data);
                        alert("修改成功");
                    }
                    else {
                        alert("修改失败");
                    }
                });
            });
        });
        $(function () {
            $button_Del.click(function () {
                $tab_Json = eval(JSON.stringify($table.bootstrapTable('getSelections')));
                if ($tab_Json[0]) {
                    $('#myModal_Del').modal('show');
                }
                else {
                    alert("请选择删除项!");
                }
            });
            $('#dialog_btn_del').click(function () {
                $tab_Json = eval(JSON.stringify($table.bootstrapTable('getSelections')));
                $("#myModal_Del").modal('hide');
                $.post("/User/RemoveJson", {
                    "id": $tab_Json[0].id
                }, function (data) {
                    if (data) {
                        $table.bootstrapTable('load', data);
                        alert("删除成功");
                    }
                    else {
                        alert("删除失败");
                    }
                });
            });
        });
        $(function () {
            $button_Add.click(function () {
                $tab_Json = eval(JSON.stringify($table.bootstrapTable('getSelections')));
                $('#myModal_Add').modal('show');
            });
            $('#dialog_btn_add').click(function () {
                $tab_Json = eval(JSON.stringify($table.bootstrapTable('getSelections')));
                $("#myModal_Add").modal('hide');
                $.post("/User/AddJson", {
                    "name": $('#Placeholder_Add').val()
                }, function (data) {
                    if (data) {
                        $table.bootstrapTable('load', data);
                        alert("添加成功");
                    }
                    else {
                        alert("添加失败");
                    }
                });
            });
        });

        $(".form-datetime").datetimepicker({
            format: "yyyy-mm-dd",
            weekStart: 1,
            startDate: "1920-1-1",
            startView: "year",
            minView: "month",
            maxView: "decade",
            language: "zh-CN",
            initialDate: "1984-1-1"
        });
    </script>
    <!-- 扩展控件自带-->

</asp:Content>
